using System;
using System.Collections.Generic;

namespace SiliverlightJavascriptIntelli
{
    public static class HostTypeHelper
    {
        public static void AddHostTypesTo(List<SilverlightType> typesToGenerateJavascriptFor)
        {
            typesToGenerateJavascriptFor.Add(HostType);
            typesToGenerateJavascriptFor.Add(ContentType);
            typesToGenerateJavascriptFor.Add(SettingType);
        }

        private static SilverlightType SettingType
        {
            get
            {
                SilverlightType ReturnType = new SilverlightType();
                ReturnType.Name = "Settings";

                ReturnType.Properties.Add(new SilverlightProperty(ReturnType, "Background", "String", "Specifies the background color of the rectangular region that display XAML content.", true, true));
                ReturnType.Properties.Add(new SilverlightProperty(ReturnType, "EnableFramerateCounter", "Boolean", "Gets or sets a value that determines whether to display the current framerate in the hosting browser's status bar. (Microsoft Internet Explorer only)", true, true));
                ReturnType.Properties.Add(new SilverlightProperty(ReturnType, "EnableRedrawRegions", "Boolean", "Shows the areas of the plug-in that are being redrawn each frame.", true, true));
                ReturnType.Properties.Add(new SilverlightProperty(ReturnType, "EnableHtmlAccess", "Boolean", "Determines whether the hosted content in the Silverlight control has access to the browser Document Object Model (DOM).", true, true));
                ReturnType.Properties.Add(new SilverlightProperty(ReturnType, "MaxFrameRate", "Number", "Specifies the maximum number of frames to render per second.", true, true));
                ReturnType.Properties.Add(new SilverlightProperty(ReturnType, "Version", "String", "Gets the version of the Silverlight control.", true, false));
                ReturnType.Properties.Add(new SilverlightProperty(ReturnType, "Windowless", "Boolean", "Determines whether the Silverlight control displays as a window-less control.", true, false));

                return ReturnType;
            }
        }

        private static SilverlightType ContentType
        {
            get
            {
                SilverlightType ReturnType = new SilverlightType();
                ReturnType.Name = "Content";

                ReturnType.Properties.Add(new SilverlightProperty(ReturnType, "ActualHeight", "Number", "Specifies the height of the rendering area of the Silverlight control.", true, false));
                ReturnType.Properties.Add(new SilverlightProperty(ReturnType, "ActualWidth", "Number", "Specifies the width of the rendering area of the Silverlight control.", true, false));
                ReturnType.Properties.Add(new SilverlightProperty(ReturnType, "FullScreen", "Boolean", "Determines whether the Silverlight control displays as a full-screen control.", true, true));
                ReturnType.Events.Add(new SilverlightEvent(ReturnType, "OnFullScreenChange", "Occurs whenever the FullScreen property of the Silverlight control changes."));
                ReturnType.Events.Add(new SilverlightEvent(ReturnType, "OnResize", "Occurs whenever the ActualHeight or ActualWidth property of the Silverlight control changes."));
                ReturnType.Methods.Add(new SilverlightMethod(ReturnType, "FindName", "Gets any object in the Silverlight object hierarchy by referencing the object's x:Name attribute value.", "DependencyObject", "A reference to the specified object if the object was successfully found; otherwise, returns null.", new SilverlightParameter("objectName", "String", "The name of the object to get.")));
                ReturnType.Methods.Add(new SilverlightMethod(ReturnType, "CreateFromXaml", "Creates XAML content dynamically.", "DependencyObject", "An object reference if the XAML content was successfully created; otherwise, returns null.", new SilverlightParameter("xamlContent", "String", "The XAML content to add to the existing Silverlight object hierarchy."), new SilverlightParameter("nameScope", "Boolean", "Determines whether to create x:Name references in XAML content that do not conflict with other named elements. The nameScope parameter is optional, and its value defaults to false if not specified.")));
                ReturnType.Methods.Add(new SilverlightMethod(ReturnType, "CreateFromXamlDownloader", "Creates XAML content dynamically using downloader content.", "DependencyObject", "An object reference if the XAML content was successfully created; otherwise, returns null.", new SilverlightParameter("downloader", "Downloader", "The object containing the downloaded content"), new SilverlightParameter( "part", "String", "The name of the specific part of the downloaded content package. When the downloaded content package is a Zip file, part refers to the contents of a filename within downloader. If the downloaded content does not represent packaged content, set part to an empty string.")));

                return ReturnType;
            }
        }

        private static SilverlightType HostType
        {
            get
            {
                SilverlightType ReturnType = new SilverlightType();
                ReturnType.Name = "Host";

                ReturnType.Methods.Add(new SilverlightMethod(ReturnType, "createObject", "The Downloader object is the only object that can by specified as the objectType parameter for the CreateObject method. If you specify an invalid objectType parameter, the CreateObject method throws an exception.", "Downloader", "An object reference if the object was successfully created.", new SilverlightParameter("objectType", "String", "The type of object to create.")));
                ReturnType.Properties.Add(new SilverlightProperty(ReturnType, "InitParams", "String", "Specifies a string that represents a set of user-defined initialization parameters. The string format of the params value is user-defined.", true, false));
                ReturnType.Properties.Add(new SilverlightProperty(ReturnType, "IsLoaded", "Boolean", "true if the Silverlight control is loaded; otherwise, false. The IsLoaded property is set to true after the XAML content in the Silverlight control has completely loaded, but before the OnLoad event occurs.", true, false));
                ReturnType.Properties.Add(new SilverlightProperty(ReturnType, "Source", "String", "Specifies the XAML content to render.", true, false));
                ReturnType.Properties.Add(new SilverlightProperty(ReturnType, "Content", "Content", string.Empty, true, false));
                ReturnType.Properties.Add(new SilverlightProperty(ReturnType, "Settings", "Settings", string.Empty, true, false));
                ReturnType.Events.Add(new SilverlightEvent(ReturnType, "OnError", "Occurs when the Silverlight control generates a runtime error."));

                return ReturnType;
            }
        }

    }
}